package com.jkzaixian.online;

import android.app.Application;

import com.BV.LinearGradient.LinearGradientPackage;
import com.brentvatne.react.ReactVideoPackage;
import com.corbt.keepawake.KCKeepAwakePackage;
import com.facebook.react.ReactApplication;

import org.wonday.pdf.RCTPdfView;

import com.RNFetchBlob.RNFetchBlobPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.github.yamill.orientation.OrientationPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.oblador.vectoricons.VectorIconsPackage;
import com.puti.paylib.PayReactPackage;
import com.reactlibrary.RNSyanImagePickerPackage;
import com.zmxv.RNSound.RNSoundPackage;

import org.devio.rn.splashscreen.SplashScreenReactPackage;

import java.util.Arrays;
import java.util.List;

import cn.reactnative.httpcache.HttpCachePackage;
import io.realm.react.RealmReactPackage;
import me.vanpan.rctqqsdk.QQSDKPackage;

public class MainApplication extends Application implements ReactApplication {

    public MyReactPackage myReactPackage;
    public MyVideoPackage myVideoPackage;

    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {

//        @Override
//        protected String getJSBundleFile() {
//        return CodePush.getJSBundleFile();
//        }

        @Override
        public boolean getUseDeveloperSupport() {
            return BuildConfig.DEBUG;
        }

        @Override
        protected List<ReactPackage> getPackages() {
            return Arrays.<ReactPackage>asList(
                    new MainReactPackage(),
                    new RCTPdfView(),
                    new RNFetchBlobPackage(),
                    new RNSoundPackage(),
                    new PayReactPackage(),
//                    new CodePush(BuildConfig.CODEPUSH_KEY, MainApplication.this, BuildConfig.DEBUG),
                    new SplashScreenReactPackage(),
                    new RNDeviceInfo(),
                    new RealmReactPackage(),
                    myReactPackage,
                    myVideoPackage,
                    new HttpCachePackage(),
                    new RNSyanImagePickerPackage(),
                    new LinearGradientPackage(),
                    new OrientationPackage(),
                    new VectorIconsPackage(),
                    new KCKeepAwakePackage(),
                    new ReactVideoPackage(),
//                    new ImagePickerPackage(),
                    new QQSDKPackage()

            );
        }

        @Override
        protected String getJSMainModuleName() {
            return "index";
        }
    };

    @Override
    public ReactNativeHost getReactNativeHost() {
        return mReactNativeHost;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        SoLoader.init(this, /* native exopackage */ false);
        myReactPackage = new MyReactPackage();
        myVideoPackage = new MyVideoPackage();
    }
}
